package com.jiyun.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.entity.Qualification;
import com.jiyun.mapper.QualificationMapper;
import com.jiyun.service.IQualificationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDate;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 聪哥哥
 * @since 2023-02-20
 */
@DubboService
public class QualificationServiceImpl extends ServiceImpl<QualificationMapper, Qualification> implements IQualificationService {


    @Autowired
    QualificationMapper qualificationMapper;

    @Override
    public Qualification findHasQualification(Integer uid, LocalDate now, Integer hid) {

        LambdaQueryWrapper<Qualification> qualificationLambdaQueryWrapper = new LambdaQueryWrapper<>();
        qualificationLambdaQueryWrapper.eq(uid!=null,Qualification::getUid,uid);
        qualificationLambdaQueryWrapper.eq(now!=null,Qualification::getQdate,now);
        qualificationLambdaQueryWrapper.eq(hid!=null,Qualification::getHid,hid);

        return qualificationMapper.selectOne(qualificationLambdaQueryWrapper);
    }
}
